import React from "react";
import { Route, Link } from "react-router-dom";

import Home from "./pages/Home/index";
import About from "./pages/About";

function App() {
  return (
    <div className="app">
      <div className="header"></div>
      <div className="main">
        <div className="left">
          {/* 导航区 */}
          <Link className="link active" to="/home">
            Home
          </Link>
          <Link className="link" to="/about">
            About
          </Link>
        </div>
        <div className="right">
          {/* 展示区，根据不同的url地址，展示不同的组件 */}

          {/* 一条路由规则 当 url 满足 /home 时，这块位置就会渲染为 Home 组件 */}
          <Route path="/home" component={Home} />
          {/* 一条路由规则 当 url 满足 /about 时，这块位置就会渲染为 About 组件 */}
          <Route path="/about" component={About} />
        </div>
      </div>
    </div>
  );
}

export default App;
